package com.hdax.dm.controller;

import com.hdax.dm.common.utils.CommonResponse;
import com.hdax.dm.dtos.item.ItemDescDto;
import com.hdax.dm.service.DmItemService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

/**
 * 商品详情查询
 */
@RestController
@RequestMapping(path = "/desc")
public class ItemDescController {

    @Autowired
    private DmItemService itemService;

    @PostMapping(path = "getItems")
    public CommonResponse<ItemDescDto> getItems(@RequestBody Map<String,String> params){
        //获取商品主键
        Long id = params.get("id") == null ? -1L : Long.parseLong(params.get("id"));

        return itemService.getItems(id);
    }
}
